﻿<div id="tb">
    <table cellpadding="0" cellspacing="0" style="width: 100%">
        <tr>
            <td>
                <a href="#" class="easyui-linkbutton" iconcls="iconfont iconfont-jia1" plain="true" onclick="$('#dg').datagrid('mfSaveRows')">确定</a>
            </td>
        </tr>
    </table>
</div>
<table id="dg" class="easyui-datagrid" rownumbers="true" fit="true" fitcolumns="true" striped="true" border="false" remotesort="false"
       autorowheight="false" toolbar="#tb">
    <thead>
        <tr>
            <th field="Code" width="100" halign='center' align="center">
                编号
            </th>
            <th field="Name" width="100" halign='center' align="center">
                名称
            </th>
            <th field="Set" width="50" halign='center' formatter="trueFalseFormatter" align="center" editor="{type:'checkbox',options:{on:'true',off:'false'}}">
                设置
            </th>
        </tr>
    </thead>
</table>
<script>
    function trueFalseFormatter(value, rowData, rowIndex) {
        if (value == 'true') {
            return '有'
        }
        else {
            return '无'
        }
    }

</script>

<script>
    var userId = queryString('Id');
    var roleType = queryString('RoleType');
    $('#dg').datagrid({
        onSuccess: function (e) {
            closeWindow(true);
        },
        url: 'GetUserRoleList', saveUrl: 'SaveUserRole?UserId=' + userId, queryParams: { UserId: userId, RoleType: roleType }
    }).datagrid('enableCellEditing');
</script>